package com.atguigu.yygh.common.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 孔德成
 * @slogan 致敬大师，致敬未来的你
 * @date 2021/9/3 3:32 下午
 * @desc
 */
public class HttpRequestHelper {

    /**
     * 将 HttpServletRequest 获取的参数集合进行类型转换
     * Map<String, String[]> -> Map<String, Object>
     *
     * @param paramMap
     * @return
     */
    public static Map<String, Object> switchMap(Map<String, String[]> paramMap) {
        Map<String, Object> resultMap = new HashMap<>(paramMap.size());
        for (Map.Entry<String, String[]> param : paramMap.entrySet()) {
            resultMap.put(param.getKey(), param.getValue()[0]);
        }
        return resultMap;
    }
}
